fix(storage): 使用文件级锁处理 content/write#2064
Merged
Merged
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
fengluodb
approved these changes
May 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
修复 #2029 合入后遗漏的一处资源写入锁粒度问题:
content/write写入viking://resources/...下的普通文件时,不再对资源根目录持有TreeLock,改为只对目标文件路径持有ExactPathLock。举例:
viking://resources/docs/api1.md和viking://resources/docs/api2.md都会竞争viking://resources/docs的树锁,第二个请求容易返回resource is busy。api1.md和api2.md,不同文件可以并发写入;同一个文件、或遇到上层树锁时仍然会互斥。Related Issue
N/A
Type of Change
Changes Made
content/write的锁路径从root_uri改为当前写入的uri,锁类型从TreeLock改为ExactPathLock。Testing
未额外运行单测。这个分支只补回 #2029 之后遗漏的
content/write文件级锁修复,并更新了已有测试的锁释放预期。Checklist
Screenshots (if applicable)
N/A
Additional Notes
这个修复只覆盖直接文件写入路径。目录级资源生命周期保护、后台语义刷新 coalesce、以及上层树锁冲突判断仍沿用 #2029 的实现。